import requests
import json

url = "https://open.oppomobile.com/iotplatform/platform/debug/product/sAem/setup"

payload_setNew = json.dumps({
  "firmwares": [
    {
      "id": "470557246150134272",
      "manufacturerCode": "924162016964",
      "productId": "sAem",
      "name": "oppo_t31x",
      "bucketName": "smarthome-iot-heytapmobi-com",
      "objectKey": "sAem-16128-1.0.107",
      "order": None,
      "target": "16128",
      "version": "1.0.107",
      "type": None,
      "dependVersion": None,
      "desc": "1、优化OTA升级稳定性；<br/>2、更新图像参数； <br/>3、修复关闭看家开关后移动追踪开关依然生效的问题；<br/>4、优化低照度下夜视切换逻辑；<br/>5、其他问题修复。",
      "status": 0,
      "remark": None,
      "isFirst": None,
      "signature": "MEQCIAj08GDYlJufhFVr8UR3WSEqf1rqMuhojff6esY+pxSVAiAQ42niGpmvno72uofZ0hU02punBXLPlUT9NejidEPMtg==",
      "createTime": "2022-10-14T03:46:30.000+00:00",
      "updateTime": "2022-10-17T10:06:39.000+00:00",
      "downloadUrl": "http://smarthome-iot-heytapmobi-com.ocs-cn-south2.heytapcs.com/sAem-16128-1.0.107?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20221014T034630Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=TVjPVAH1rfVp2-JFICfZSSrGBVraMiukfMXV0oAI%2F20221014%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=491dbd8ae23242236f4a1c0a89118165a32ce4d12b0b266f2cf345d3cb8f7667",
      "required": False,
      "debugStatus": 0,
      "versionCode": 107,
      "productName": None,
      "productModel": None,
      "isEarphoneUpgrade": None,
      "canOperateUpgrade": None
    }
  ],
  "uiPages": [
    {
      "id": "455452208771794944",
      "productId": "sAem",
      "name": "20220902B-C006",
      "type": 1,
      "desp": "测试",
      "issueTime": None,
      "onlineTime": "2022-09-19T06:17:55.000+00:00",
      "offlineTime": None,
      "status": 5,
      "remark": None,
      "sourceType": 3,
      "version": "2",
      "accessType": 1,
      "downloadUrl": "https://sdk-smarthome.nearme.com.cn/20220902155852-com.heytap.camera.gwell_release_false_1.0.65_feature.apk",
      "createTime": "2022-09-02T11:24:28.000+00:00",
      "debugStatus": 1,
      "isSpecificPlugin": False
    },
    {
      "id": "426109620420078080",
      "productId": "sAem",
      "name": "20220613A-P004",
      "type": 2,
      "desp": None,
      "issueTime": None,
      "onlineTime": "2022-06-13T12:10:25.000+00:00",
      "offlineTime": None,
      "status": 5,
      "remark": None,
      "sourceType": 1,
      "version": "2",
      "accessType": 1,
      "downloadUrl": "https://ocs-cn-south1.heytapcs.com/ui-confignet-page/20220613A-P004-426109620420078080",
      "createTime": "2022-06-13T12:07:30.000+00:00",
      "debugStatus": 1,
      "isSpecificPlugin": None
    }
  ],
  "plugins": [
    {
      "id": "278",
      "manufacturerCode": "924162016964",
      "packageName": "com.heytap.camera.gwell",
      "supportJumpType": "3,5,8",
      "version": "10017",
      "versionName": "1.0.17",
      "protocolVersion": "2",
      "minAppVersion": None,
      "maxAppVersion": None,
      "downloadUrl": "https://sdk-smarthome.nearme.com.cn/20220804174944-com.heytap.camera.gwell_1.0.17_4724ed7_220804.apk",
      "status": 5,
      "remark": None,
      "accessType": 1,
      "introduction": "bug修复",
      "createTime": "2022-08-04T09:50:16.000+00:00",
      "terminalType": 1,
      "debugStatus": None,
      "type": 0,
      "categoryCode": "camera"
    },
    {
      "id": "367",
      "manufacturerCode": "924162016964",
      "packageName": "com.heytap.camera.gwell",
      "supportJumpType": "3,5,8",
      "version": "10073",
      "versionName": "1.0.73",
      "protocolVersion": "2",
      "minAppVersion": None,
      "maxAppVersion": None,
      "downloadUrl": "https://sdk-smarthome.nearme.com.cn/20220927152651-com.heytap.camera.gwell_release_false_1.0.73_release.apk",
      "status": 5,
      "remark": None,
      "accessType": 1,
      "introduction": "1、修复SD卡回放切换问题",
      "createTime": "2022-09-27T07:26:59.000+00:00",
      "terminalType": 0,
      "debugStatus": None,
      "type": 0,
      "categoryCode": "camera"
    }
  ]
})
headers_setNew = {
  'Connection': 'keep-alive',
  'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"',
  'Pragma': 'no-cache',
  'nonce': 'tpuzxsaxss',
  'appKey': 'd986259e2fcd403b9f4218b9def55db5',
  'Cache-Control': 'no-cache',
  'sec-ch-ua-mobile': '?0',
  'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36',
  'Content-Type': 'application/json',
  'Accept': 'application/json, text/plain, */*',
  'timestamp': '1666005417840',
  'innerAuth': 'iotCloud',
  'sign': 'fddab86f624ebdaf3560d7540d3b9849',
  'sec-ch-ua-platform': '"Windows"',
  'Origin': 'https://open.oppomobile.com',
  'Sec-Fetch-Site': 'same-origin',
  'Sec-Fetch-Mode': 'cors',
  'Sec-Fetch-Dest': 'empty',
  'Referer': 'https://open.oppomobile.com/iotplatform/open-platform-web/product/create-product?productId=sAem',
  'Accept-Language': 'zh-CN,zh;q=0.9',
  'Cookie': 'otrack_jssdk_store=eyJkZXZpY2VJZCI6ImViMmU2N2QyLWRmYmQtNGJjMi1hYjQ3LWFmYWJkMWVmNmMxOCIsInVzZXJJZCI6IiJ9; newopkey=zACRuwQX9mSCQgiW7WB_cE8nIyvBH76eg5A7eAFhEnjKCvsQZJW8s2nJhHfpbBzv2ItsxrPENGA; opkey=eyJpdiI6IjQyM0thNGFQdDVpMDM5bElxV2luQnc9PSIsInZhbHVlIjoibGppWXRMTitLTURGYngrbmUzWk5LM0llZERkNlM3dDlDVUlYdU95V3hmV2t0QWtwRDFVM3FUU01BN1dEUldPcEpVN3JcL0ZjWTJNSE5QelZoMW5nMDBuQU1EdTlFbnBMd3BqMzJNM1QrM1BsbW9jRll4VDFNMG16a1R4bUNOMlBQIiwibWFjIjoiIn0%3D; isLogin=1; OPPOSID=zACRuwQX9mSCQgiW7WB_cE8nIyvBH76eg5A7eAFhEnjKCvsQZJW8s2nJhHfpbBzv2ItsxrPENGA; STORE_USERNAME=reoqoo; openplat=ffbd9cc5f68a4495c5a4c940fa40a22b; dev_id=753022011'
}

response = requests.request("PUT", url, headers=headers_setNew, data=payload_setNew)

print(response.text)